#pragma once
#include "DXAMLCommon.h"
#include "IPALMalloc.h"
#include "IPALMemory.h"
#include "XFixedSizeAllocator.h"
#include "IPALOfferableHeap.h"


class IPALMemoryServices
{
public:
	virtual void *       OSMemoryAllocate( XUINT32 cSize) = 0;
	virtual void *       OSMemoryResize( void *pAddress, XUINT32 cSize) = 0;
	virtual void         OSMemoryFree( void *pAddress) = 0;
	virtual XUINT32      GetCurrentThreadId() = 0;
	virtual XINT32       MemoryCreate( IPALMalloc **ppMalloc) = 0;
	virtual HRESULT      AllocatePages( XUINT32 cBytes, void **ppPages, XUINT32 flags) = 0;
	virtual HRESULT      ReleasePages( XUINT32 cBytes, void *pPages) = 0;
	virtual HRESULT      MarkPages( XUINT32 cBytes, void *pPages, XUINT32 flags) = 0;
	virtual HRESULT      CreatePALMemoryFromBuffer( XUINT32 cbBuffer, XBYTE *pBuffer, IPALMemory **ppPALMemory) = 0;
	virtual HRESULT      GetProcessOfferableHeap( IPALOfferableHeap **ppHeap) = 0;
	virtual HRESULT      RegisterMemoryPressureCallbacks( XINT32 (__stdcall *pfnAddMemoryPressure)(XUINT64), XINT32 (__stdcall *pfnRemoveMemoryPressure)(XUINT64)) = 0;
	virtual void         UpdateAllocatedMemory( XINT64 cSize) = 0;
	virtual void         ReportMemoryPressureToGC() = 0;
	virtual void         SetMemoryPressureReportingPolicy(XUINT32) = 0;
	virtual HRESULT      GetSharedPointerControlBlockAllocator( XFixedSizeAllocator **ppAllocator) = 0;
	virtual HRESULT      ReleaseSharedPointerControlBlockAllocator( XUINT32 *outLeakedItems) = 0;
	virtual void         Delete(void *) = 0;
	virtual void         DeleteArray(void *) = 0;

};